package com.rew.canteenchefs.configs;

import org.springframework.boot.context.embedded.EmbeddedServletContainer;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.stereotype.Component;

/**
 *  修改默认Tomcat端口.
 *
 * Created by HuiWen Ren on 2016/12/1.
 */
@Component
public class MyEmbeddedServletContainerFactory
        extends TomcatEmbeddedServletContainerFactory {

    public EmbeddedServletContainer getEmbeddedServletContainer
            (ServletContextInitializer... initializers) {
        //设置端口
        //必要时
        this.setPort(8080);
        return super.getEmbeddedServletContainer(initializers);
    }

}
